package com.socialuni.sdk.utils.model.RO;

import com.socialuni.sdk.api.model.RO.user.base.SocialUserRO;
import com.socialuni.sdk.model.DO.user.UserDO;

public class SocialUserROUtil {
    /*public static SocialUserRO getMineUser() {
        UserDO userDO = UserUtil.getMineUser();
        assert userDO != null;
        return SocialUserROUtil.userDOToRO(userDO, true);
    }
*/
    public static SocialUserRO getMineUser(UserDO userDO) {
        return SocialUserROUtil.userDOToRO(userDO, true);
    }

    public static SocialUserRO getUser(UserDO userDO ) {
        return SocialUserROUtil.userDOToRO(userDO, false);
    }

    /*public static SocialUserRO getUser(Integer userId) {
        UserDO userDO = UserUtil.get(userId);
        return SocialUserROUtil.userDOToRO(userDO, false);
    }*/

    public static SocialUserRO userDOToRO(UserDO userDTO, Boolean isMine) {
        //user基础信息
        SocialUserRO user = new SocialUserRO();
        //user详情信息
//        user.setIsMine(isMine);

        user.setId(userDTO.getId().toString());
        user.setNickname(userDTO.getNickname());
        user.setAvatar(userDTO.getAvatar());
        user.setGender(userDTO.getGender());
        user.setAge(userDTO.getAge());
        user.setCity(userDTO.getCity());
        if (isMine) {
            //为自己返回生日，方便修改，和手机号
            /*user.setBirthday(userDTO.getBirthday());

            String realPhoneNum = userDTO.getPhoneNum();
            if (StringUtils.isNotEmpty(realPhoneNum)) {
                realPhoneNum = realPhoneNum.substring(0, 3) + "*****" + realPhoneNum.substring(8);
                user.setPhoneNum(realPhoneNum);
            }*/
        }
        //未来可以考虑直接手机号也授权
        return user;
    }
}